<?php
/*=============================================================================
#     FileName: WxsetController.class.php
#         Desc: 
#       Author: Wuyuanhang
#        Email: 
#   LastChange: 2017-10-09 11:22:02
#      History:
#      Paramer: 
=============================================================================*/

namespace Admin\Controller;
//use User\Api\UserApi;

class WxsetController extends AdminController {

    public function index(){
        //$nickname       =   I('nickname');
        //$map['status']  =   array('egt',0);
        //if(is_numeric($nickname)){
        //    $map['uid|nickname']=   array(intval($nickname),array('like','%'.$nickname.'%'),'_multi'=>true);
        //}else{
        //    $map['nickname']    =   array('like', '%'.(string)$nickname.'%');
        //}

        //$list   = $this->lists('Member', $map);
        //int_to_string($list);
        //$this->assign('_list', $list);
        //$this->meta_title = '微信设置';
        $config = M('WxSet')->find();

        $this->assign('config', $config);
        $this->display();
    }

    public function save($config)
    {
        if($config && is_array($config)){

            $wxmodel = M('WxSet');

            if ($wxmodel->count()) {
                $res = $wxmodel->where(array('id'=>2))->save($config);
            }

            if (false === $res) {
                return $this->error('保存失败！');
            }
        }

        return $this->success('保存成功！');
    }
}
